package org.cqupt.content.counter.utils;

import java.io.IOException;

import org.cqupt.content.counter.entity.ArticleEntity;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class ArticleContent {
	/**
	 * 根据url，获取文章的标题和内容
	 * @param arEntity
	 * @throws IOException
	 */
	public static void getArticle(ArticleEntity arEntity) throws IOException {
		String url = arEntity.getUrl();
		Document doc = Jsoup.connect(url).timeout(3000000).get();
		String title = doc.getElementsByTag("article").select("h1").text();
		arEntity.setTitle(title);
		String content = doc.getElementsByTag("article").select("p").text();
		arEntity.setContent(content);
	}
}
